package com.ruoyi.project.tool.swagger;


import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

import java.util.Map;

public class SendMsgController {

    /**
     * 火警
     * @param args
     */
    public static void main(String[] args) {

//        /**
//         *消防预警
//         */
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAIYtsFiewWlROK", "suDxlkeZabGW3EagtCZY9uNIyb8oUj");
        IAcsClient client = new DefaultAcsClient(profile);
        CommonRequest request = new CommonRequest();
        request.setVersion("2017-05-25");
        request.setAction("SendSms");
        request.setMethod(MethodType.POST);
        request.setDomain("dysmsapi.aliyuncs.com");
        request.putQueryParameter("RegionId", "cn-hangzhou");
        request.putQueryParameter("PhoneNumbers", "18252578446");
        request.putQueryParameter("SignName", "乐创迅为电子科技");
        request.putQueryParameter("TemplateCode", "SMS_174278162");
        request.putQueryParameter("TemplateParam", "{\"adress\":\"1111\",\"type\":\"火警\",\"time\":\"1111\"}");
        try {
            CommonResponse response = client.getCommonResponse(request);
            JSONObject jsonObject=JSONObject.parseObject(response.getData());
            System.out.println(response.getData());
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        }

        /**
         *用户远传装置
         */
//        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI4FtwKeMTnjrZZcQnvh7B", "pGF9uxTpGWsFUWehUYaOeFq7qgA5pc");
//        IAcsClient client = new DefaultAcsClient(profile);
//        CommonRequest request = new CommonRequest();
//        request.setVersion("2017-05-25");
//        request.setAction("SendSms");
//        request.setMethod(MethodType.POST);
//        request.setDomain("dysmsapi.aliyuncs.com");
//        request.putQueryParameter("RegionId", "cn-hangzhou");
//        request.putQueryParameter("PhoneNumbers", "18252578446");
//        request.putQueryParameter("SignName", "乐创迅为电子科技");
//        request.putQueryParameter("TemplateCode", "SMS_175570528");
//        request.putQueryParameter("TemplateParam", "{\"adress\":\"1111\",\"type\":\"火警\",\"time\":\"1111\",\"guzhang\":\"1111\"}");
//        try {
//            CommonResponse response = client.getCommonResponse(request);
//            JSONObject jsonObject=JSONObject.parseObject(response.getData());
//            System.out.println(response.getData());
//        } catch (ServerException e) {
//            e.printStackTrace();
//        } catch (ClientException e) {
//            e.printStackTrace();
//        }



    }
}
